<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<script type="text/javascript">
	$(document)
			.ready(
					function() {
						$('#pageTitle')
								.text(
										'<spring:message code="viewCipeprojectModifications.heading" />');
						$("#viewCipeprojectModificationsForm").validate({
							rules : {
								name : {
									required : true
								}
							}
						});
						
						$('.attachmentPath').click(function() {
							var fileName = $('div', this).text();
							window.open("<c:url value='/openFile.do' />?fileName=" + fileName, "_blank", "left=20, top=20, width=700, height=700, toolbar=1, resizable=0").focus();
						});
					});
	$('.close-button').click(function() {
		//if (confirm('Are you sure you want to close the form?')) {
			window.location = '../secure/showDashboard.do';
		//}
	});
</script>
<div id="viewCipeprojectModificationsDiv">
	<form:form name="viewCipeprojectModificationsForm" id="viewCipeprojectModificationsForm" method="post" modelAttribute="cipeproject">
		<form:hidden path="id" />
		<div class="main_form">
			<div class="form_head">
				<a href="#" class="close-button gray_btn floatR">Close Form</a><br class="clear" />
			</div>
			<div class="form_cont">
				<div id="viewCipeprojectModificationsDiv" class="hastable" style="overflow: auto">
					<table class="tablesorter">
						<thead>
							<tr>
								<th>ID</th>
								<th>Modification Type</th>
								<th>Modified From</th>
								<th>Modified To</th>
								<th>Modified Date</th>
								<th>Modified By</th>
								<th>File Location of Modified Document</th>
							</tr>
						</thead>
						<tbody>
							<c:choose>
								<c:when test="${fn:length(cipeproject.cipeprojectmodifications) > 0}">
									<c:forEach items="${cipeproject.cipeprojectmodifications}" var="modification">
										<tr>
											<td>${modification.id}</td>
											<td>${modification.modificationType.modificationTypeDesc}</td>
											<td>${modification.modifiedFrom}</td>
											<td>${modification.modifiedTo}</td>
											<td>${modification.formattedModifiedDate}</td>
											<td>${modification.modifiedBy.fullName}</td>
											<td><a href="#" onclick="return false;" class="attachmentPath"><div>${modification.attachment}</div></a></td>
										</tr>
									</c:forEach>
								</c:when>
								<c:otherwise>
									<tr>
										<td colspan="7" style="padding-left: 10px;">No modifications found.</td>
									</tr>
								</c:otherwise>
							</c:choose>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</form:form>
</div>